#include "mysig.h"
#include <time.h>

void (*signal(int, void (*) (int))) (int);
static void myhandle(int);

int main() {
    /* If SIGUSR1 is triggered when handler is doing
     * program will not interupt handler, and until handler is over,
     * then a new handler will be called.
     */
    signal(SIGUSR1, myhandle);
    pause();
    return 0;
}

static void myhandle(int sig) {
    time_t mytime = time(NULL);
    printf("receive sig %d @ %s\n", sig, ctime(&mytime));
    sleep(10);
}
